/*
 * Powered By dico
 * Since 2017 - 2018
 */package com.seeyoui.kensite.bussiness.orderlang.productAttachment.service;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.seeyoui.kensite.common.base.service.BaseService;

import java.util.*;

import com.seeyoui.kensite.common.base.domain.EasyUIDataGrid;
import com.seeyoui.kensite.common.base.service.BaseService;
import com.seeyoui.kensite.common.exception.CRUDException;
import com.seeyoui.kensite.common.util.*;
import com.seeyoui.kensite.common.constants.StringConstant;
import com.seeyoui.kensite.bussiness.orderlang.productAttachment.domain.ProductAttachment;
import com.seeyoui.kensite.bussiness.orderlang.productAttachment.persistence.ProductAttachmentMapper;

/**
 * ProductAttachment
 * @author dico
 * @version 2.0
 * @since 1.0
 * @date 2018-02-07
 */

@Service
public class ProductAttachmentService extends BaseService {
	
	@Autowired
	private ProductAttachmentMapper productAttachmentMapper;
	
	public List<ProductAttachment> findAttaListByProductId(String productId){
		return productAttachmentMapper.findAttaListByProductId(productId);
	}
	
	public void deleteByProductId(String productId){
		productAttachmentMapper.deleteByProductId(productId);
	}
	
	public void deleteFileByProductId(String productId){
		productAttachmentMapper.deleteFileByProductId(productId);
	}

	/**
	 * 根据ID查询单条数据
	 * @param id
	 * @return
	 * @throws CRUDException
	 */
	public ProductAttachment findOne(String id) throws CRUDException{
		return productAttachmentMapper.findOne(id);
	}
	
	/**
	 * 查询数据集合
	 * @param productAttachment
	 * @return
	 * @throws CRUDException
	 */
	public List<ProductAttachment> findList(ProductAttachment productAttachment) throws CRUDException {
		return productAttachmentMapper.findList(productAttachment);
	}
	
	/**
	 * 查询所有数据集合
	 * @param productAttachment
	 * @return
	 * @throws CRUDException
	 */
	public List<ProductAttachment> findAll(ProductAttachment productAttachment) throws CRUDException {
		return productAttachmentMapper.findAll(productAttachment);
	}
	
	/**
	 * 查询数据总数
	 * @param productAttachment
	 * @return
	 * @throws CRUDException
	 */
	public int findTotal(ProductAttachment productAttachment) throws CRUDException {
		return productAttachmentMapper.findTotal(productAttachment);
	}
	
	/**
	 * 查询数据总数排除当前数据
	 * @param productAttachment
	 * @return
	 * @throws CRUDException
	 */
	public int findExTotal(ProductAttachment productAttachment) throws CRUDException {
		return productAttachmentMapper.findExTotal(productAttachment);
	}
	
	/**
	 * 数据新增
	 * @param productAttachment
	 * @throws CRUDException
	 */
	public void save(ProductAttachment productAttachment) throws CRUDException{
		productAttachment.preInsert();
		productAttachmentMapper.save(productAttachment);
	}
	
	/**
	 * 数据修改
	 * @param productAttachment
	 * @throws CRUDException
	 */
	public void update(ProductAttachment productAttachment) throws CRUDException{
		productAttachment.preUpdate();
		productAttachmentMapper.update(productAttachment);			
	}
	
	/**
	 * 数据删除
	 * @param listId
	 * @throws CRUDException
	 */
	public void delete(List<String> listId) throws CRUDException {
		productAttachmentMapper.delete(listId);
	}
	
	/**
	 * 数据假删除
	 * @param productAttachment
	 * @throws CRUDException
	 */
	public void remove(ProductAttachment productAttachment) throws CRUDException{
		productAttachment.preUpdate();
		productAttachmentMapper.remove(productAttachment);			
	}
	
}